Skip to content

[RFC] Friends#21937

Draft
DanielEScherzer wants to merge 10 commits intophp:masterfrom
DanielEScherzer:friends
Draft

[RFC] Friends#21937
DanielEScherzer wants to merge 10 commits intophp:masterfrom
DanielEScherzer:friends

Conversation

@DanielEScherzer
Copy link
Copy Markdown
Member

No description provided.

Comment thread Zend/tests/friends/property_access.phpt
@datbunneh
Copy link
Copy Markdown

Personally I'd prefer protected friendship only. Or at least by default. Perhaps make an option to declare a private friend explicitly. I think it would be beneficial to have an explicit distinction between accessible and truly private members. And since inheritance is not a great practice in most cases (i.e. composition over it), having a protected method/property in some systems that extensively use composition could indicate that they are used in some friendship relation. While private stay private.

@DanielEScherzer
Copy link
Copy Markdown
Member Author

Personally I'd prefer protected friendship only. Or at least by default. Perhaps make an option to declare a private friend explicitly. I think it would be beneficial to have an explicit distinction between accessible and truly private members. And since inheritance is not a great practice in most cases (i.e. composition over it), having a protected method/property in some systems that extensively use composition could indicate that they are used in some friendship relation. While private stay private.

Not going to do that, the idea is that friends can access private parts
"inheritance is not a great practice in most cases" may be your view, but there is plenty of inheritance in the PHP ecosystem
And nothing is truly private when reflection is always available

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants